package com.ty.service;

import com.ty.dao.AccountDao;
import com.ty.entity.Account;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.executor.parameter.ParameterHandler;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.session.ResultHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class AccountService {
    @Autowired
    private AccountDao AccountDao;


    @Transactional
    public void transfer(int fromId, int toId, double money) {


        // 转出
        AccountDao.minusMoney(fromId, money);
        int i = 5/0;
        // 转入
        AccountDao.addMoney(toId, money);
    }
}